package com.inspur.edp.web.formmetadata.formformat.handler;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.inspur.edp.formserver.viewmodel.formentity.ButtonGroup;
import com.inspur.edp.formserver.viewmodel.formentity.MethodGroup;
import com.inspur.edp.formserver.viewmodel.formentity.ObjectData;
import com.inspur.edp.formserver.viewmodel.formentity.VoFormModel;
import com.inspur.edp.lcm.metadata.api.entity.GspMetadata;
import io.iec.edp.caf.common.JSONSerializer;
import org.junit.Before;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.util.List;

public class WFFormFormatMobileHandlerTest {

    private WFFormFormatMobileHandler handler;
    private ObjectMapper objectMapper;

    @Before
    public void setUp() {
        handler = new WFFormFormatMobileHandler();
        objectMapper = new ObjectMapper(); // For parsing JSON strings into JsonNode
    }

    @Test
    public void testGetObjectData() throws Exception {
//        File jsonFile = new File("/Workspaces/MobileProject/liuyuan/ui-model/web-form-metadata/src/test/java/com/inspur/edp/web/formmetadata/formformat/handler/mobileFormContent.json");
//        ObjectMapper objectMapper = new ObjectMapper();
//
//        // 读取JSON文件并转换为JsonNode
//        JsonNode jsonNode = objectMapper.readTree(jsonFile);
//        List<ButtonGroup> buttonGroups = handler.getButtons(jsonNode);
//        System.out.println(JSONSerializer.serialize(buttonGroups));
//
//        System.out.println("sss");
    }
    @Test
    public void getVoFormModel() throws Exception {
//        File jsonFile = new File("/Workspaces/MobileProject/liuyuan/ui-model/web-form-metadata/src/test/java/com/inspur/edp/web/formmetadata/formformat/handler/mobileFormContent.json");
//        ObjectMapper objectMapper = new ObjectMapper();
//
//        // 读取JSON文件并转换为JsonNode
//        JsonNode jsonNode = objectMapper.readTree(jsonFile);
//
//        System.out.println(JSONSerializer.serialize(handler.getObjectData(jsonNode)));
//        System.out.println(JSONSerializer.serialize(handler.getMethods(jsonNode)));
//        System.out.println(JSONSerializer.serialize(handler.getButtons(jsonNode)));




    }

}
